package main

import (
	"context"
	"fmt"
	"google.golang.org/grpc"
	"google.golang.org/grpc/credentials/insecure"
	"gorm/grpc/common"
)

func main() {

	//无加密模式
	conn, err := grpc.Dial(":8899", grpc.WithTransportCredentials(insecure.NewCredentials()))
	if err != nil {
		panic(err)
	}
	conn.Connect()
	defer conn.Close()

	userClient := common.NewUserClient(conn)
	reply, err := userClient.GetById(context.Background(), &common.UserRequest{Id: 100})
	if err != nil {
		panic(err)
	}

	fmt.Printf("[client] got reply: %v\n", *reply)

}
